var eventproxy=require('eventproxy');
var ep=new eventproxy();

function mockGet(cb){
    setTimeout(function () {
        console.log('网络请求');
        cb(null,'网络请求');
    },Math.random()*1000|0);
}

function mockRead(cb){
    setTimeout(function () {
        console.log('读取文件');
        cb(null,'读取文件');
    },Math.random()*1000|0);
}

function mockQuery(cb){
    setTimeout(function () {
        console.log('查询数据库');
        cb(null,'查询数据库');
    },Math.random()*1000|0);
}

ep.all('get','read','query', function (data1, data2, data3) {
    console.log('data1:',data1);
    console.log('data2:',data2);
    console.log('data3:',data3);
});

mockGet(function (err,data) {
    ep.emit('get',data);
});

mockRead(function (err,data) {
    ep.emit('read',data);
});

mockQuery(function (err,data) {
    ep.emit('query',data);
});









